package com.rtwo.tio.server;

import com.rtwo.tio.common.Common;
import org.tio.server.ServerGroupContext;
import org.tio.server.TioServer;
import java.io.IOException;

/**
 * Created by hasee on 2018/7/4.
 */
public class ServerStart {

    public static ServerTioHandlerImp aioHandler = new ServerTioHandlerImp();

    public static ServerTioListener aioListener = new ServerTioListener();

    public static ServerGroupContext serverGroupContext = new ServerGroupContext(aioHandler,aioListener);

    public static TioServer tioServer = null;

    public static String serverIp = Common.HOST;

    public static int serverPort = Common.PORT;

    public static void main(String[] args) throws IOException {
//        serverGroupContext.setHeartbeatTimeout(Common.HEARTBEAT);
        serverGroupContext.setName("TioServer");
        tioServer = new TioServer(serverGroupContext);
        tioServer.start(serverIp,serverPort);
    }

}
